package springDemo;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.stage.Stage;
import springDemo.entity.Student;
import springDemo.entity.Teacher;

public class testMain extends Application {

	public static void main(String[] args) {
		launch(args);
	}
	public void start(Stage stage){
		ApplicationContext applicationContext=new ClassPathXmlApplicationContext("./springDemo/testContext.xml");
		Teacher teacher=(Teacher)applicationContext.getBean("teacher");
		Student student=(Student)applicationContext.getBean("student");
		teacher.setName("liang");
		student.setName("zhangsan");
		teacher.getStudents().add(student);
		student.getTeachers().add(teacher);
		Group group=new Group();
		TextArea text=new TextArea();
		text.autosize();
		group.getChildren().add(text);
		text.appendText(teacher.getName()+"\n"+student.getName());
		Scene scene=new Scene(group,600,300);
		stage.setScene(scene);
		stage.show();
	}

}
